﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DTO;
using System.Data;
using System.Data.SqlClient;

namespace DAO
{
    public class ChiTietHoaDonDAO
    {
        public static bool Insert(ChiTietHoaDonDTO ct)
        {
            bool result = false;

            string strSQLEmployee = "Insert into ChiTietHoaDonKhachHang(MaHD,MonAn,SoLuong,ThanhTien) " +
                "values (@MaHD,@MonAn,@SoLuong,@ThanhTien)";

            try
            {
                // Create List Sql Parameter
                List<SqlParameter> sqlParams = new List<SqlParameter>();
                sqlParams.Add(new SqlParameter("@MaHD", ct.MaHD));
                sqlParams.Add(new SqlParameter("@MonAn", ct.MaMonAn));
                sqlParams.Add(new SqlParameter("@SoLuong", ct.SoLuong));
                sqlParams.Add(new SqlParameter("@ThanhTien", ct.ThanhTien));
                // Call execute none query

                int n = SqlDataAccessHelper.ExcuteNoneQuery(strSQLEmployee, sqlParams);//.ExecuteNoneQuery(strSQLEmployee, sqlParams);
                if (n == 1)
                    result = true;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return result;
        }
    }
}
